Skip to content

fix: read the valign of a credit-image - #457

Merged
webern merged 1 commit into
mainfrom
m/mxdev-crdtvaln
Sep 19, 2026
Merged

webern merged 1 commit into
mainfrom
m/mxdev-crdtvaln

Conversation

@webern

@webern webern commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Human Summary

Seems plausible that this is the correct way to read valign. This one was both found and fixed by AI.

Summary

Reading a <credit-image> threw its valign attribute away, so a credit-image alignment did not
survive a round trip. getImageData in src/private/mx/impl/PageTextFunctions.cpp discarded it on
purpose, because the generic getPositionData cannot read a picture's alignment: a picture uses
valign-image (top, middle, bottom, no baseline) rather than the valign a text element uses, and
the generic value getter is compiled out on the type mismatch, so a present attribute came back as
the default baseline.

The read now happens off the element, in one helper shared with the direction <image> reader:
getImageValign in src/private/mx/impl/PositionFunctions.h, next to the writer's
setImageValignFromVerticalAlignment, called from both readers so they cannot drift.
DirectionReader::parseImage loses its own inline switch, and the ValignImage.h include it no
longer needs. An absent attribute still reads as unspecified, and this reader never produces
baseline. The writer is unchanged. The comment in PageImageData.h that said vertical alignment was
not modeled is corrected.

Testing

  • New creditRoundTrip.imageValignSurvives fails before the fix (top, middle and bottom all read back unspecified) and passes after
  • New creditRoundTrip.imageValignIsReadFromXml reads a spelled-out valign="middle"; fails before, passes after
  • New creditRoundTrip.imageValignAbsentStaysUnspecified
  • make api-test passes (5891 assertions in 660 test cases)
  • make api-roundtrip passes with the newly pinned synthetic/credit-image.3.0.xml (415 of 415 pinned)
  • make api-roundtrip-discover: 415 pass, 425 fail; before the fix 414 pass, 426 fail, credit-image.3.0.xml being the file the fix unlocked
  • make test-all passes (core round trip, core unit, api-test, api-roundtrip)
  • make fmt and make fmt-check

References

@webern webern added bug software defect non-breaking fixes or implementation that do not require breaking changes impl Affects the mx::impl layer ai Issues opened by, or through, a coding agent. labels Sep 19, 2026
@webern
webern merged commit 1b14538 into main Sep 19, 2026
8 checks passed
@webern
webern deleted the m/mxdev-crdtvaln branch September 19, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Issues opened by, or through, a coding agent. bug software defect impl Affects the mx::impl layer non-breaking fixes or implementation that do not require breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read the valign of a credit-image

1 participant